package hapi.receive;

import hapi.ontology.HL7Ontology;
import jade.content.lang.sl.SLCodec;
import jade.core.Agent;
import jade.domain.DFService;
import jade.domain.FIPAException;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;

public class ReceiveAgent extends Agent{
	
	private static final long serialVersionUID = 1L;

	public void setup() {
		
		//System.out.println("[Receive Agent: Setup init...]");
		// Register languages and ontologies
		getContentManager().registerLanguage(new SLCodec());
		getContentManager().registerOntology(HL7Ontology.getInstance());

		//Create a Service Description
		ServiceDescription sd = new ServiceDescription();
		sd.setType(HL7Ontology.SERVICE_PROVIDER);
		sd.setName(getLocalName());
		
		// Register with the DF
		DFAgentDescription dfd = new DFAgentDescription();
		dfd.setName(getAID());
		dfd.addServices(sd);
		try {
			DFService.register(this, dfd);
		} catch (FIPAException fe) {
			fe.printStackTrace();
		}
		addBehaviour(new RedirectorBehaviour(this));
}

}

